﻿using System.Collections.Generic;
using UnityEngine;

namespace ns
{
    public class ObjectConfigurationReader : MonoBehaviour
    {
        public Dictionary<string, string> Map;//复用的时候这里返回类型要改
        public ObjectConfigurationReader(string fileName) 
        {
            Map=new Dictionary<string, string>();
            string configFile = ConfigurationReader.GetConfigFile(fileName);
            ConfigurationReader.Reader(configFile, BulidMap);
        }

        /// <summary>
        /// 具体的构建规则
        /// </summary>
        /// <param name="line">当前行</param>
        private void BulidMap(string line)
        {
            line = line.Trim();
            if (string.IsNullOrEmpty(line)) return;
            Map.Add(line.Split('=')[0], line.Split('=')[1]);
        }
    }
}